# 影刀日志增强

def log_enhancer(log_func):
    """
    打印日志时增加流程名和指令行数信息
    """
    def wrapper(*my_args, **kwargs):
        _block = kwargs.get("_block", None)
        text = kwargs["text"]
        try:
            text = text()
        except:
            pass
        if _block and len(_block) >= 2:
            kwargs["text"] = f'''【{_block[0]}】 - 第【{_block[1]}】条指令：{text}'''
        res = log_func(*my_args, **kwargs)

        return res

    return wrapper

xbot_visual.programing.log = log_enhancer(xbot_visual.programing.log)